﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Dynamics.NAV.Metro.Data
{
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
    public class NavCustomer
    {
        public int Index;

        [XmlElementAttribute("No")]
        public string No { get; set; }

        public bool NameExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(Name));
            }
        }

        [XmlElementAttribute("Name")]
        public string Name { get; set; }

        public bool ContactExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(Contact));
            }
        }

        [XmlElementAttribute("Contact")]
        public string Contact { get; set; }

        public bool AddressExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(Address));
            }
        }

        [XmlElementAttribute("Address")]
        public string Address { get; set; }

        public bool Address2Exists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(Address2));
            }
        }

        [XmlElementAttribute("Address_2")]
        public string Address2 { get; set; }

        public bool CityExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(City));
            }
        }

        [XmlElementAttribute("City")]
        public string City { get; set; }
        
        public bool StateExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(State));
            }
        }


        [XmlElementAttribute("State")]
        public string State { get; set; }

        public bool ZipCodeExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(ZipCode));
            }
        }

        [XmlElementAttribute("Zip_Code")]
        public string ZipCode { get; set; }

        public bool CountryCodeExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(CountryCode));
            }
        }

        [XmlElementAttribute("Country_Code")]
        public string CountryCode { get; set; }

        public bool PhoneNoExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(PhoneNo));
            }
        }

        [XmlElementAttribute("Phone_No")]
        public string PhoneNo { get; set; }

        public bool EmailExists
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(Email));
            }
        }

        [XmlElementAttribute("E_Mail")]
        public string Email { get; set; }

        public bool CityStateZipExists
        { 
            get 
            {
                return (!string.IsNullOrWhiteSpace(City) || !string.IsNullOrWhiteSpace(State) || !string.IsNullOrWhiteSpace(ZipCode));
            }
        }

        public string CityStateZip
        {
            get { return string.Format("{0}, {1} {2}", City, State, ZipCode); }
        }

        [XmlElementAttribute("Balance")]
        public double Balance { get; set; }

        [XmlElementAttribute("Balance_Due")]
        public double BalanceDue { get; set; }

        [XmlElementAttribute("Credit_Limit_LCY")]
        public double CreditLimitLCY { get; set; }
    }
}
